package com.example.providerdemo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;

import java.util.concurrent.TimeUnit;

@SpringBootApplication
@EnableDiscoveryClient
public class ProviderDemoApplication {

    public static void main(String[] args) throws InterruptedException {
        ConfigurableApplicationContext context = SpringApplication.run(ProviderDemoApplication.class, args);
//        while (true){
//            String userName = context.getEnvironment().getProperty("user.name");
//            String userAge = context.getEnvironment().getProperty("user.age");
//            // 获取当前部署的环境
//            String currentEnv = context.getEnvironment().getProperty("current.env");
//            System.err.println("in "+currentEnv+" enviroment; "+"user name :" + userName + "; age: " + userAge);
//            TimeUnit.SECONDS.sleep(1);
//        }
    }

}
